package my.design.proxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * @author zp
 * @version 1.0
 * @description: TODO
 * @date 2022/10/17 18:45
 */
public class JdkProxyInvocationHandler implements InvocationHandler {
    private final Object target;

    public JdkProxyInvocationHandler(Object target) {
        this.target = target;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println("JDK代理执行之前");
        Object object = method.invoke(target,args);
        System.out.println("JDK代理执行之后");
        return object;
    }
}
